package com.bhs.redis;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisSentinelPool;

import java.util.HashSet;
import java.util.Set;

public class Redis {
    public static Jedis redisJedis(){
        // 哨兵服务列表
        Set<String> set = new HashSet<>();
        set.add("192.168.64.181:5000");
        set.add("192.168.64.181:5001");
        set.add("192.168.64.181:5002");
        // 哨兵连接池
        JedisSentinelPool pool = new JedisSentinelPool("mymaster", set);
        // 获取连接池中数据操作工具
        return pool.getResource();
    }
}
